<template>
  <div>
    <TbTitle level="2" title="（1）分支机构、代表机构情况表" />
    <table border="0" class="m-table" v-for="itemMechanism in mechanism">
      <tbody>
        <tr class="td-head">
          <td class="td-head">名称</td>
          <td colspan="3"><span>{{ itemMechanism.mechanismName }}</span></td>
          <td>机构类型</td>
          <td colspan="3">
            {{ dictToVal(orgTypeOptions, itemMechanism.mechanismType) }}
          </td>
        </tr>
        <tr>
          <td class="td-head">业务范围</td>
          <td colspan="8"><span>{{ itemMechanism.mechanismBusinessScope }}</span></td>
        </tr>
        <tr>
          <td class="td-head">设立方式</td>
          <td colspan="3"><span>{{ dictToVal(dict1, itemMechanism.establishType) }}</span></td>
          <td>设立时间</td>
          <td colspan="3"><span>{{ itemMechanism.establishTime }}</span></td>
        </tr>
        <tr>
          <td class="td-head">是否在协会网站公开</td>
          <td colspan="8">
            <span>{{ yesNoBool(itemMechanism.associationWebsite) }}</span>
          </td>
        </tr>
        <tr>
          <td class="td-head">住所</td>
          <td colspan="3">
            <span>{{ itemMechanism.mechanismAddress }}</span>
          </td>
          <td>邮编</td>
          <td colspan="3">
            <span>{{ itemMechanism.postalCode }}</span>
          </td>
        </tr>
        <tr>
          <td class="td-head" rowspan="2">负责人</td>
          <td style="width: 100px;">姓名</td>
          <td style="width: 50px;">性别</td>
          <td style="width: 130px;">出生年月</td>
          <td>政治面貌</td>
          <td>学历</td>
          <td>任职程序</td>
          <td style="width: 120px;">手机</td>
        </tr>
        <tr>
          <td style="width: 153px;">
            <span>{{ itemMechanism.mechanismResponsibleName }}</span>
          </td>
          <td style="width: 153px;">
            <span>{{ ['男', '女'][itemMechanism.responsibleSex - 1] }}</span>
          </td>
          <td>
            <span>{{ itemMechanism.responsibleBirthday }}</span>
          </td>
          <td>
            <span>{{ dictToVal(dict2, itemMechanism.responsiblePolitics) }}</span>
          </td>
          <td>
            <span>{{ dictToVal(dict3, itemMechanism.responsibleQualification) }}</span>
          </td>
          <td>
            <span>{{ dictToVal(dict4, itemMechanism.organizationalStructure) }}</span>
          </td>
          <td>
            <span>{{ itemMechanism.mechanismTelephone }}</span>
          </td>
        </tr>
        <tr>
          <td class="td-head">组织机构</td>
          <td colspan="8"></td>
        </tr>
        <tr>
          <td class="td-head" rowspan="2">财务管理</td>
          <td colspan="2">财务核算</td>
          <td colspan="6">
            <span>{{ dictToVal(dict5, itemMechanism.mechanismType) }}</span>
            <span>{{ itemMechanism.mechanismType }}</span>
          </td>
        </tr>
        <tr>
          <td colspan="2">专项基金</td>
          <td colspan="6">
            原始数额(
            <span>{{ itemMechanism.specialFund }}</span>
            )元,{{ itemMechanism.examineYear }}年年末余额(
            <span>{{ itemMechanism.specialFundOther }}</span>
            )元〔专项基金管理机构填写本栏〕
          </td>
        </tr>
        <tr>
          <td class="td-head">活动业务</td>
          <td colspan="2">{{ itemMechanism.examineYear }}年度主要业务活动概述：</td>
          <td colspan="7">
            <span>{{ itemMechanism.businessActivities }}</span>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
  <div>
    <TbTitle level="2" title="（2）办事机构情况表" />
    <el-table :header-cell-style="{ background: '#f0f7fc', color: '#000' }" :data="detailInfo.workList" border>
      <el-table-column type="index" align="center" width="70" label="序号">
      </el-table-column>
      <el-table-column prop="mechanismName" width="360" align="center" label="名称">
      </el-table-column>
      <el-table-column prop="establishTime" align="center" label="设立时间">
      </el-table-column>
      <el-table-column prop="mechanismFunction" align="center" label="职能">
      </el-table-column>
      <el-table-column prop="mechanismTelephone" align="center" label="联系电话">
      </el-table-column>
    </el-table>
  </div>
  <div>
    <TbTitle level="2" title="（3）实体机构情况表" />
    <el-table :header-cell-style="{ background: '#f0f7fc', color: '#000' }" :data="detailInfo.entityList" border>
      <el-table-column type="index" align="center" width="70" label="序号">
      </el-table-column>
      <el-table-column prop="mechanismName" width="360" align="center" label="名称">
      </el-table-column>
      <el-table-column prop="mechanismRegisteredCapital" align="center" label="注册资金（万元）">
      </el-table-column>
      <el-table-column prop="establishTime" align="center" label="设立时间"></el-table-column>
      <el-table-column prop="mechanismShareholdingRatio" align="center" label="持股比例">
        <template #default="scope">
          {{ `${scope.row.mechanismShareholdingRatio}%` }}
        </template>
      </el-table-column>
      <el-table-column prop="mechanismBusinessScope" align="center" label="经营范围">
      </el-table-column>
    </el-table>
  </div>
  <div class="msg-tip">
    <p>
      注：实体机构是指社会组织因自身业务活动和与其宗旨相适应的需要，举办的事业性实体、经济实体(可以投资设立企业法人，也可以设立非法人的经营机构)或者民办非企业单位。
    </p>
  </div>
</template>

<script setup lang="ts">
import TbTitle from '@/views/yearCheck/components/TbTitle.vue'
import { ref, reactive, inject, getCurrentInstance } from 'vue'
import { getDictEstablishWay, getDictPolitics, getDictXueli, getDictAll } from '@/api/dict/index'
const { proxy } = getCurrentInstance();
const dictToVal = proxy.$dictToVal
const yesNoBool = proxy.$yesNoBool

const dict1 = ref([])
const dict2 = ref([])
const dict3 = ref([])
const dict4 = ref([])
const dict5 = ref([])
let orgTypeOptions = ref([{ id: '1', name: '办事机构' }, { id: '2', name: '实体机构' }, { id: '3', name: '分支机构' }])


const { getDetailInfo } = inject('getDetailInfo')

let detailInfo = reactive({})
let mechanism = reactive({})
getDetailInfo().then(res => {
  Object.assign(detailInfo, res.data)
  Object.assign(mechanism, res.data.mechanism)
})
let getDictInfo = () => {
  //设立方式
  getDictEstablishWay().then(res => {
    dict1.value = res.data
  })

  //政治面貌
  getDictPolitics().then(res => {
    dict2.value = res.data
  })
  //学历
  getDictXueli().then(res => {
    dict3.value = res.data
  })
  //任职程序
  getDictAll('organizationalStructure').then(res => {
    dict4.value = res.data
  })
  //财务核算
  getDictAll('financialAccounting').then(res => {
    dict5.value = res.data
  })
}
getDictInfo()

</script>
<style lang="scss" scoped>
.msg-tip {
  padding: 20px 0;
  color: #000;
  font-family: '微软雅黑';
}
</style>
